<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="https://cdn.bootcss.com/animate.css/3.5.2/animate.min.css">
</head>
<body>
    <div id="app" style="overflow: hidden">
        <button @click="comp='aaa'">A</button>
        <button @click="comp='bbb'">B</button>
        <transition
            enter-active-class="animated slideInLeft"
            leave-active-class="animated slideOutRight"
            mode="out-in"
        >
            <component :is="comp"></component>
        </transition>
    </div>
</body>
<script src="./base/vue.js"></script>

<script>
    // 利用component标签来代替某一个组件，设置is属性为真正组件的名字
    //transition组件默认是进入和离开同时发生。
    //vue中对于transition提供了过渡模式
    //in-out  新元素先进行过渡，完成之后当前元素过渡离开
    //out-in  当前元素先进行过渡，完成之后新元素过渡进入

    new Vue({
        el:"#app",
        data:{
            comp:"aaa"
        },
        components:{
            "aaa":{
                template:"<h1>AAAAAAAAAAAAAAAAAA</h1>"
            },
            "bbb":{
                template:"<h1>BBBBBBBBBBBBBBBBBB</h1>"
            }
        }
    })

</script>
</html>